const fs = require('fs')
const path = require('path')

const Router = require('koa-router')
const router = new Router()
// 读取当前目录下的所有文件
const files = fs.readdirSync(__dirname)

files.forEach((filename) => {
  if (filename !== 'index.js') {
    const r = require(`./${filename}`)
    router.use(r.routes())
  }
})

module.exports = router
